package com.sx.code.controller;

import com.sx.code.CodeDubboService;
import com.sx.code.service.CodeService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shengx
 * @date 2020/5/10 21:05
 */
//@RestController
//@RequestMapping("/code")
@Service
public class CodeController implements CodeDubboService {
    @Autowired
    private CodeService codeService;

    public Boolean create(String email){
        System.out.println("email:" + email);
        return codeService.createCode(email);
    }

    public Integer validate(String email, String code){
        System.out.println("email:" + email +  " code:" + code);
        return codeService.checkCode(email, code);
    }
}
